﻿@using RBS.Core.Model.Hotel 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
@{
    ViewBag.Title = "ApiIndex";
    Layout = "";
    var hotelid = ViewBag.hotelId;
    RBS.Core.Model.Hotel.H_Hotels hotel = new RBS.Core.BLL.Hotel.H_Hotels().GetModelByCache(hotelid);
   
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>呷饭网</title>  
     <link href="@Url.Content("~/Content/skin1/homepage.css")" rel="stylesheet" /> 
    <link href="@Url.Content("~/Content/ApiCSS/hotelDetail.css")" rel="stylesheet" /> 
    <style> 
       #iCenter{height:120px}
    </style>
    <script language="javascript" src="http://webapi.amap.com/maps?v=1.3&key=6f8865b2771b70d90e610a0d6861227b"></script>
   <script language="javascript">
       var mapObj, toolBar;
       //初始化地图对象，加载地图
       function mapInit() {
           mapObj = new AMap.Map("iCenter", {
               //二维地图显示视口
               view: new AMap.View2D({
                   center: new AMap.LngLat(@hotel.Location),//地图中心点
                   zoom: 13 //地图显示的缩放级别
               })
           });
       /*    //地图中添加地图操作ToolBar插件
           mapObj.plugin(["AMap.ToolBar"], function () {
               toolBar = new AMap.ToolBar();
               mapObj.addControl(toolBar);
           });*/

           //地图初始化时，在地图上添加一个marker标记,鼠标点击marker可弹出自定义的信息窗体
           addMarker();
       }
       //添加marker标记
       function addMarker() {
           mapObj.clearMap();
           var marker = new AMap.Marker({
               map: mapObj,
               position: new AMap.LngLat(@hotel.Location), //位置 
               icon: "http://webapi.amap.com/images/0.png" //复杂图标       
           });
          /* AMap.event.addListener(marker, 'click', function () { //鼠标点击marker弹出自定义的信息窗体
               infoWindow.open(mapObj, marker.getPosition());
           });*/
       }

       //实例化信息窗体
       var infoWindow = new AMap.InfoWindow({
           isCustom: true,  //使用自定义窗体
           content: createInfoWindow('方恒假日酒店&nbsp;&nbsp;<span style="font-size:11px;color:#F00;">价格:318</span>', "<img src='http://tpc.googlesyndication.com/simgad/5843493769827749134' style='position:relative;float:left;margin:0 5px 5px 0;'>地址：北京市朝阳区阜通东大街6号院3号楼 东北 8.3 公里<br/>电话：010 64733333<br/><a href='http://baike.baidu.com/view/6748574.htm'>详细信息</a>"),
           offset: new AMap.Pixel(16, -45)//-113, -140
       });

       //构建自定义信息窗体	
       function createInfoWindow(title, content) {
           var info = document.createElement("div");
           info.className = "info";

           //可以通过下面的方式修改自定义窗体的宽高
           //info.style.width = "400px";

           // 定义顶部标题
           var top = document.createElement("div");
           top.className = "info-top";
           var titleD = document.createElement("div");
           titleD.innerHTML = title;
           var closeX = document.createElement("img");
           closeX.src = "http://webapi.amap.com/images/close2.gif";
           closeX.onclick = closeInfoWindow;

           top.appendChild(titleD);
           top.appendChild(closeX);
           info.appendChild(top);


           // 定义中部内容
           var middle = document.createElement("div");
           middle.className = "info-middle";
           middle.style.backgroundColor = 'white';
           middle.innerHTML = content;
           info.appendChild(middle);

           // 定义底部内容
           var bottom = document.createElement("div");
           bottom.className = "info-bottom";
           bottom.style.position = 'relative';
           bottom.style.top = '0px';
           bottom.style.margin = '0 auto';
           var sharp = document.createElement("img");
           sharp.src = "http://webapi.amap.com/images/sharp.png";
           bottom.appendChild(sharp);
           info.appendChild(bottom);
           return info;
       }

       //关闭信息窗体
       function closeInfoWindow() {
           mapObj.clearInfoWindow();
       }

</script>
</head> 
<body onLoad="mapInit()"> 
<div class="wrapall">
	<div class="hotel01"> 
         <div id="iCenter"></div>	
	    <h1>@hotel.H_Name</h1>
		<p class="hoteltext">@hotel.Feature</p>
	</div> 
</div>
</body>
</html>
}